{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "扇形的圆心角（弧度）: 1.04\n",
      "扇形的圆心角（度）: 59.67\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "def calculate_central_angle(arc_length, radius):\n",
    "    \"\"\"\n",
    "    计算扇形的圆心角（以弧度为单位）。\n",
    "    \n",
    "    参数:\n",
    "        arc_length (float): 扇形的弧长。\n",
    "        radius (float): 扇形的半径。\n",
    "    \n",
    "    返回:\n",
    "        float: 扇形的圆心角（弧度）。\n",
    "    \"\"\"\n",
    "    if radius <= 0:\n",
    "        raise ValueError(\"半径必须为正数\")\n",
    "    if arc_length < 0:\n",
    "        raise ValueError(\"弧长不能为负数\")\n",
    "    \n",
    "    # 计算圆心角（弧度）\n",
    "    central_angle_radians = arc_length / radius\n",
    "    \n",
    "    return central_angle_radians\n",
    "\n",
    "# 示例\n",
    "arc_length = 3020  # 弧长\n",
    "radius = 2900      # 半径\n",
    "\n",
    "# 调用函数\n",
    "central_angle_radians = calculate_central_angle(arc_length, radius)\n",
    "\n",
    "# 将弧度转换为度\n",
    "central_angle_degrees = np.degrees(central_angle_radians)\n",
    "print(f\"扇形的圆心角（弧度）: {central_angle_radians:.2f}\")\n",
    "print(f\"扇形的圆心角（度）: {central_angle_degrees:.2f}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
